package models;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import play.db.ebean.Model;
import util.SituacaoMatricula;

@Entity
@Cacheable(false)
public class Matricula extends Model{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public long id;

	@Temporal(TemporalType.DATE)
	public Date dtMatricula;
	
	@Enumerated(EnumType.STRING)
	public SituacaoMatricula situacao;
	
	@Temporal(TemporalType.DATE)
	public Date dtCadastro;
	
	// ------------------relacionamentos---------------------//
	@OneToOne
	public SolicitacaoMatricula solicitacao;
	
	@ManyToOne
	public Turma turma;
	
	@ManyToOne
	public Usuario aluno;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy="aluno")
	public List<AtividadeAluno> atividadesAluno = new ArrayList<AtividadeAluno>();
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy="aluno")
	public List<ProvaAluno> provasAluno = new ArrayList<ProvaAluno>();

}
